Ext.define('js.foundation.TitleAddPanel', {
    extend: 'Ext.Container',
    id:'TitleAddPanel',
    style: "background-color:#fff;",
  /*  margin:'10 30 30 30',*/
    height:100,
    config: {
        autoScroll: true,
        border: false,
        layout: {
            type: 'hbox',
            align: 'stretch'
        }
    },
    initComponent: function () {
        let lbhd={
            xtype: 'radiogroup',
            fieldLabel: '楼板厚度',
            labelWidth: 90,
            margin:'30 50 30 20',
            id:'floor_thickness',
            name:'floor_thickness',
            value: this.floor_thickness,
            width: '20%',
            vertical: true,
            items: [
                { boxLabel: '有', inputValue: '1',margin:'2 20 0 0',id:'lbhdA'},
                { boxLabel: '无', inputValue: '2',margin:'2 0 0 0',id:'lbhdB'}
            ],
            listeners :{
                render:function (value) {
                    var bizVal = value.initialConfig.value;
                    if(bizVal == 2){
                        Ext.getCmp('lbhdB').setValue(true);
                    }else{
                        Ext.getCmp('lbhdA').setValue(true);
                    }
                }
            }
        };
        let zysygn={
            xtype: 'radiogroup',
            fieldLabel: '重要使用功能（室内空间尺寸）',
            labelWidth: 270,
            id:'indoor_space_size',
            name:'indoor_space_size',
            margin:'30 20 30 200',
               value: this.indoor_space_size,
            width: '30%',
            vertical: true,
            items: [
                { boxLabel: '是', inputValue: '1',margin:'2 20 0 0',id:'zysygnA'},
                { boxLabel: '否', inputValue: '2',margin:'2 0 0 0',id:'zysygnB'}
            ],
            listeners :{
                render:function (value) {
                    var bizVal = value.initialConfig.value;
                    if(bizVal == 2){
                        Ext.getCmp('zysygnB').setValue(true);
                    }else{
                        Ext.getCmp('zysygnA').setValue(true);
                    }
                }
            }
        };
        let buttonAA={
            xtype: 'button',
            scala: 'medium',
            margin:'30 20 30 600',
            cls:'button-Intelligent-sensor',
            text: '保存修改',
            height:'40',
            handler: this.toPage,
            engineering_id:this.engineering_id,
            scope: this,
        };
        this.items = [lbhd,zysygn,buttonAA];
        this.callParent(arguments);
    },
    toPage: function(btn){
        let engineering_id=btn.engineering_id;

        Ext.Ajax.request({
            url: '/progressRoutes',
            method: "POST",
            async: true,  //异步调用AJAX
            params: {
                action_type: 'progressOtherUpdate',
                engineering_id:engineering_id,
                floor_thickness:Ext.getCmp('floor_thickness').getValue(),
                indoor_space_size:Ext.getCmp('indoor_space_size').getValue(),
            },
            success: function (response, opts) {
                Ext.toast('成功');
            },
            failure: function () {
                Ext.toast(`获取异常报警数据失败：${response.status}`);
            }  // 请求失败的回调函数
        });



    }
});